home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 with MFC / Programming Windows 95 with MFC (Microsoft Programming Series)(097-0001465)(1996).iso / NT / CODE / CHAP06 / PAINT3 / PAINT3.H < prev    next >
C/C++ Source or Header  |  1996-04-05  |  2KB  |  75 lines

  1. //***********************************************************************
  2. //
  3. //  Paint3.h
  4. //
  5. //***********************************************************************
  6.  
  7. class CLine : public CObject
  8. {
  9.     DECLARE_SERIAL (CLine)
  10.  
  11. private:
  12.     CPoint m_ptFrom;
  13.     CPoint m_ptTo;
  14.     UINT m_nWidth;
  15.     COLORREF m_crColor;
  16.  
  17. public:
  18.     CLine () {}
  19.     CLine (CPoint, CPoint, UINT, COLORREF);
  20.     virtual void Serialize (CArchive&);
  21.     virtual void Draw (CDC*);
  22. };
  23.  
  24. class CMyApp : public CWinApp
  25. {
  26. public:
  27.     virtual BOOL InitInstance ();
  28. };
  29.  
  30. class CMainWindow : public CFrameWnd
  31. {
  32. private:
  33.     UINT m_nColor;
  34.     UINT m_nWidth;
  35.     CPoint m_ptFrom;
  36.     CPoint m_ptTo;
  37.     CObArray m_lineArray;
  38.     CString m_strFileName;
  39.     CString m_strPathName;
  40.  
  41.     static const COLORREF crColors[8];
  42.     static const char szFilters[];
  43.  
  44.     BOOL LoadFile (LPCSTR);
  45.     BOOL SaveFile (LPCSTR);
  46.     void UpdateWindowTitle ();
  47.     void InvertLine (CDC*, CPoint, CPoint);
  48.     void DeleteAllLines ();
  49.  
  50. public:
  51.     CMainWindow ();
  52.     ~CMainWindow ();
  53.  
  54. protected:
  55.     afx_msg void OnPaint ();
  56.     afx_msg void OnFileNew ();
  57.     afx_msg void OnFileOpen ();
  58.     afx_msg void OnFileSave ();
  59.     afx_msg void OnFileSaveAs ();
  60.     afx_msg void OnFileExit ();
  61.     afx_msg void OnUpdateFileUI (CCmdUI*);
  62.     afx_msg void OnWidth (UINT);
  63.     afx_msg void OnUpdateWidthUI (CCmdUI*);
  64.     afx_msg void OnColor (UINT);
  65.     afx_msg void OnUpdateColorUI (CCmdUI*);
  66.     afx_msg void OnLButtonDown (UINT, CPoint);
  67.     afx_msg void OnMouseMove (UINT, CPoint);
  68.     afx_msg void OnLButtonUp (UINT, CPoint);
  69.     afx_msg void OnContextMenu (CWnd*, CPoint);
  70.     afx_msg void OnMeasureItem (int, LPMEASUREITEMSTRUCT);
  71.     afx_msg void OnDrawItem (int, LPDRAWITEMSTRUCT);
  72.     
  73.     DECLARE_MESSAGE_MAP ()
  74. };
  75.